<?php
	class Security
	{	
		public static function getLeoHasRecht($recht_text_id, $app, $db)
		{
			$result = false;
		
			if(isset($_SESSION["id"]))
			{
				foreach($db->recht()->where("text_id = ?", 'VOLLZUGRIFF')->select("id") as $recht)
				{
					if($db->leo_recht()->where("leo_id = ? and recht_id = ?", array($_SESSION["id"], $recht["id"]))->Count('*') == 1)
						$result = true;
				}	
				
				if($result != true)
				{
					foreach($db->recht()->where("text_id = ?", $recht_text_id)->select("id") as $recht)
					{
						if($db->leo_recht()->where("leo_id = ? and recht_id = ?", array($_SESSION["id"], $recht["id"]))->Count('*') == 1)
							$result = true;
					}	
				}			
			}
			
			return $result;
		}
	}
?>